package lab03.Test01;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

/**
 * Created by lenovo on 2017/11/16.
 */
public class FileOutputStreamTest {
    public static void main(String[] args) throws IOException {
        String path="E:\\Hello.txt";           //命名一个文件夹并赋值给path      字符流
        BufferedWriter writer=null;
        try{
        writer=new BufferedWriter(new FileWriter(path));       //实例化一个对象write
        writer.write("hello,world");                    //写入东西
        writer.newLine();                                 //表示换行
        writer.write("01010101");
        writer.newLine();
        writer.write("bye！！！");
        }catch(IOException e){


        e.printStackTrace();
        }finally{
            try {
                writer.close();                       //关闭写入这个操作
            }catch (IOException e){
                e.printStackTrace();
            }
        }
    }

}
